{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" type="image/png" href="{% static 'app01/img/logo.png' %}">
    <title>车友圈</title>
    <!-- Slick Slider -->
    <link rel="stylesheet" type="text/css" href="{% static 'app01/css/slick.min.css' %}"/>
    <link rel="stylesheet" type="text/css" href="{% static 'app01/css/slick-theme.min.css' %}"/>
    <!-- Feather Icon-->
    <link href="{% static 'app01/css/feather.css' %}" rel="stylesheet" type="text/css">
    <!-- Bootstrap core CSS -->
    <link href="{% static 'app01/css/bootstrap.min.css' %}" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="{% static 'app01/css/style.css' %}" rel="stylesheet">

    <!-- CSS -->
    <link rel="stylesheet" href="{% static 'app01/css/bootstrap.css' %}">
    <link rel="stylesheet" href="{% static 'app01/css/bootstrap-responsive.css' %}">
    <link rel="stylesheet" href="{% static 'app01/css/prettyPhoto.css' %}"/>
    <link rel="stylesheet" href="{% static 'app01/css/custom-styles.css' %}">

    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <link rel="stylesheet" href="{% static 'app01/css/style-ie.css' %}"/>
    <![endif]-->
    <!-- JS -->
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="{% static 'app01/js/jquery.easing.1.3.js' %}"></script>
    <script src="{% static 'app01/js/bootstrap.js' %}"></script>
    <script src="{% static 'app01/js/jquery.prettyPhoto.js' %}"></script>
    <script src="{% static 'app01/js/jquery.quicksand.js' %}"></script>
    <script src="{% static 'app01/js/jquery.custom.js' %}"></script>

    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        ul {
            list-style: none;
        }

        #nav {
            height: 50px;
            background-color: #46474a;
        }

        #nav ul li {
            width: 120px;
            float: left;
        }

        #nav ul li a {
            display: block;
            width: 120px;
            height: 50px;
            line-height: 50px;
            text-decoration: none;
            font-size: 18px;
            /* font-weight: bold; */
            color: white;
            text-align: center;
        }

        #nav ul li a:hover {
            background-color: white;
            color: #46474a;
        }

        .dropdown {
            position: relative;
            display: inline-block;
        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            min-width: 160px;
            box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
            padding: 12px 16px;
            z-index: 1;
        }

        .dropdown:hover .dropdown-content {
            display: block;
        }
    </style>
    <style type="text/css">
        li.margin {
            margin-left: 50px;
        }
    </style>
</head>
<body>
<!-- 导航栏 -->
<div id="nav" style="margin: -10px;margin-right: 0px;">
    <ul>
        <li class="margin"><img src="{% static 'app01/img/logo.png' %}" style="width: 87.4px;height: 50px;">
        </li>
        <li><a href="{% url 'purchase_index' %}">购物商城</a></li>
        <li><a href="/moment/">车友圈</a></li>
        <li><a href="/view_power/">充电规划</a></li>
        <li><a href="/chatbot/botmain/">智能客服</a></li>
        <li><a href="/repair/">维修保养</a></li>

        {% if "info" in request.session.keys %}

        <li class="dropdown">
            <a href="#">
                我的</a>
            <div class="dropdown-content">
                <a href="{% url 'show_order' %}" style="color: #46474a;font-size: 17px;">购物订单</a>
                <a href="/repair/list/" style="color: #46474a;font-size: 17px;">维修订单</a>
                <a href="/infomation/" style="color: #46474a;font-size: 17px;">个人信息</a>
                <a href="/signout/" style="color: #46474a;font-size: 17px;">注销</a>
            </div>
        </li>

        {% else %}
        <li><a href="/signin/">登录 / 注册</a></li>
        {% endif %}

    </ul>
</div>
<!-- /.导航栏结束
<header id="head" class="secondary"></header>-->

<div class="py-4">
    <div class="container">
        <div class="row">

            <!-- 左边 -->
            <aside class="col col-xl-3 order-xl-1 col-lg-6 order-lg-2 col-md-6 col-sm-6 col-12" style="width: 20%">
                <!-- 个人栏 -->
                <div class="box mb-3 shadow-sm border rounded bg-white profile-box text-center">
                    <div class="py-4 px-3 border-bottom">
                        <img src="{{ user.u_photo }}" class="img-fluid mt-2 rounded-circle" alt="Responsive image">
                        <h5 class="font-weight-bold text-dark mb-1 mt-4">{{ user.u_name }}</h5>
                        <p class="mb-0 text-muted">{{ user.u_cha }}</p>
                    </div>
                    <div class="d-flex">
                        <div class="col-6 border-right p-3">
                            <a href="/myfollow" class="font-weight-bold text-dark mb-1">{{ user.u_follow }}</a>
                            <p class="mb-0 text-black-50 small">关注</p>
                        </div>
                        <div class="col-6 p-3">
                            <a href="/myfans" class="font-weight-bold text-dark mb-1">{{ user.u_fans }}</a>
                            <p class="mb-0 text-black-50 small">粉丝</p>
                        </div>
                    </div>
                    <div class="overflow-hidden border-top">
                        <a class="font-weight-bold p-3 d-block" href="/mymmt"> 我的动态 </a>
                    </div>
                </div>
                <!-- 热门话题 -->
                <div class="box mb-3 shadow-sm rounded bg-white view-box overflow-hidden">
                    <div class="box-title border-bottom p-3">
                        <h6 class="m-0">热门话题</h6>
                    </div>
                    <ul>
                        <li style="line-height: 30px">
                            <a href="#">青岛某男子送其对象一辆兰博劳斯，女方跪下并说——“你是我的神”</a>
                        </li>
                        <li style="line-height: 30px">
                            <a href="#">一男子爱驾撞到栏杆车头扭转90度，维修师傅见到高呼：“有请潘周聃”</a>
                        </li>
                    </ul>

                </div>
            </aside>


            <!-- Main Content -->
            <main class="col col-xl-6 order-xl-2 col-lg-12 order-lg-1 col-md-12 col-sm-12 col-12" style="width: 60%">
                <div class="box shadow-sm border rounded bg-white mb-3 osahan-share-post">
                    <!-- 最上面选项 -->
                    <ul class="nav nav-justified border-bottom osahan-line-tab" id="myTab" role="tablist">
                        <li class="nav-item">
                            <a class="nav-link active" id="home-tab" data-toggle="tab" href="/moment/" role="tab"
                               aria-controls="home" aria-selected="true" style="color: #222222;"><i
                                    class="feather-edit"></i> 发动态</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" id="profile-tab" data-toggle="tab" href="/moment/" role="tab"
                               aria-controls="profile" aria-selected="false" style="color: #222222;"><i
                                    class="feather-image"></i> 写文章</a>
                        </li>
                    </ul>
                    <!-- 帖子框 -->
                    <form action="/moment/" method="post" enctype="multipart/form-data">
                        {% csrf_token %}
                        <div class="tab-content" id="myTabContent">
                            <!--发动态 -->
                            <div class="tab-pane show active" id="home" role="tabpanel" aria-labelledby="home-tab">
                                <div class="p-3 d-flex align-items-center w-100" href="#">
                                    <div class="dropdown-list-image mr-3">
                                        <img class="rounded-circle" src="{{ user.u_photo }}" alt="">
                                        <div class="status-indicator bg-success"></div>
                                    </div>
                                    <div class="w-100">
                                        <textarea placeholder="有什么新鲜事想告诉大家..."
                                                  class="form-control border-0 p-0 shadow-none" rows="1"
                                                  name="t_content"></textarea>
                                    </div>
                                </div>
                            </div>
                            <!--写文章 -->
                            <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
                                <div class="p-3 w-100">
                                    <textarea placeholder="Write your thoughts..."
                                              class="form-control border-0 p-0 shadow-none" rows="3"></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="border-top p-3 d-flex align-items-center">
                            <div class="mr-auto">
                                添加图片：<input type="file" accept="image/png, image/jpeg, image/gif, image/jpg"
                                            name="t_photo" style="font-size: 10px; height: 36px;"></div>
                            <div class="mr-auto"><a href="#" class="text-link small"><i class="feather-map-pin"></i>
                                添加位置信息</a></div>
                            <div class="flex-shrink-1">
                                <button type="button" class="btn btn-light btn-sm"
                                        style="background-image: linear-gradient(to bottom, #999999, #efefef); font-size: 10px;">
                                    预览
                                </button>
                                <button type="submit" class="btn btn-primary btn-sm"
                                        style="background-image: linear-gradient(to bottom, #999999, #d95019); font-size: 10px;">
                                    发布
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <!-- 所有帖子 -->
                {% for t in topics %}
                <div class="box shadow-sm border rounded bg-white mb-3 osahan-post">
                    <div class="p-3 d-flex align-items-center border-bottom osahan-post-header">
                        <div class="dropdown-list-image mr-3">
                            <a href="/detail/{{ t.id }}"><img class="rounded-circle" src="{{ t.t_uphoto }}" alt=""></a>
                            <div class="status-indicator bg-success"></div>
                        </div>
                        <div class="font-weight-bold">
                            <div class="text-truncate">{{ t.t_uname }}</div>
                            <div class="small text-gray-500">{{ t.t_ucha }}</div>
                        </div>
                        <span class="ml-auto small">{{ t.create_time }}</span>
                    </div>
                    <div class="p-3 border-bottom osahan-post-body">
                        <p class="mb-0">{{ t.t_content }}<a href="#">#{{ t.t_chaohua }}</a></p>
                    </div>
                    <div class="p-3 border-bottom osahan-post-footer">
                        <!--<a href="#" class="mr-3 text-secondary"><i class="feather-heart text-danger"></i> {{ t.t_like }}</a>-->
                        <a href="#" id="div_digg" data-id="{{ t.id }}" class="mr-3 text-secondary"><i
                                class="feather-heart text-danger"></i> {{ t.t_like }}</a>
                        <a href="/detail/{{ t.id }}" class="mr-3 text-secondary"><i class="feather-message-square"></i>
                            {{ t.t_comment }}</a>
                        <a href="#" class="mr-3 text-secondary"><i class="feather-share-2"></i> {{ t.t_share }}</a>
                    </div>
                </div>
                {% endfor %}
            </main>


            <!-- 右边 -->
            <aside class="col col-xl-3 order-xl-3 col-lg-6 order-lg-3 col-md-6 col-sm-6 col-12" style="width: 20%">
                <div class="box shadow-sm border rounded bg-white mb-3">
                    <div class="box-title border-bottom p-3">
                        <h6 class="m-0">可能认识的车友</h6>
                    </div>
                    <div class="box-body p-3">
                        <div class="d-flex align-items-center osahan-post-header mb-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/p8.png' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">某帅哥</div>
                                <div class="small text-gray-500">哈佛大学在读学生
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm"><i
                                    class="feather-user-plus"></i></button>
                           </span>
                        </div>
                    </div>
                    <div class="box-body p-3">
                        <div class="d-flex align-items-center osahan-post-header mb-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/mm.jpg' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">萌萌</div>
                                <div class="small text-gray-500">海外学者
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm"><i
                                    class="feather-user-plus"></i></button>
                           </span>
                        </div>
                    </div>
                    <div class="box-body p-3">
                        <div class="d-flex align-items-center osahan-post-header mb-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/ww.jpg' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">王王</div>
                                <div class="small text-gray-500">高校科研者
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm"><i
                                    class="feather-user-plus"></i></button>
                           </span>
                        </div>
                    </div>
                    <div class="box-body p-3">
                        <div class="d-flex align-items-center osahan-post-header mb-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/mei.png' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">小猪</div>
                                <div class="small text-gray-500">穿搭博主
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm"><i
                                    class="feather-user-plus"></i></button>
                           </span>
                        </div>
                    </div>
                    <div class="box-body p-3">
                        <div class="d-flex align-items-center osahan-post-header mb-3 people-list">
                            <div class="dropdown-list-image mr-3">
                                <img class="rounded-circle" src="{% static 'app01/img/ku.jpg' %}" alt="">
                                <div class="status-indicator bg-success"></div>
                            </div>
                            <div class="font-weight-bold mr-2">
                                <div class="text-truncate">酷酷</div>
                                <div class="small text-gray-500">汽车爱好者
                                </div>
                            </div>
                            <span class="ml-auto"><button type="button" class="btn btn-light btn-sm"><i
                                    class="feather-user-plus"></i></button>
                           </span>
                        </div>
                    </div>
                </div>
            </aside>
        </div>
    </div>
</div>

<!-- Bootstrap core JavaScript -->
<script src="{% static 'app01/js/jquery.min.js' %}"></script>
<script src="{% static 'app01/js/bootstrap.bundle.min.js' %}"></script>
<!-- slick Slider JS-->
<script type="text/javascript" src="{% static 'app01/js/slick.min.js' %}"></script>
<!-- Custom scripts for all pages-->
<script src="{% static 'app01/js/osahan.js' %}"></script>
<!--点赞功能ajax-->
<script>
    $("#div_digg").click(function () {
        $.ajax({
            url: "/digg/",
            type: "post",
            data: {
                "csrfmiddlewaretoken": $("[name='csrfmiddlewaretoken']").val(),
                "article_id": $(this).attr('data-id'),
            },
            success: function (data) {
                console.log(data);
                if (data.state) {
                    var val = parseInt($("#div_digg").text());
                    $("#div_digg").text(val + 1);
                }
            }
        })
    })
</script>
</body>
</html>